package oop2;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class JavaClass {
    String clsName;
    String dirTeacher;
    String[]stus=new String[30];// null

    //加新生
    //Scanner in=new Scanner(System.in);
    public void add(String newStu){
        for(int i=0;i<stus.length;i++){
           if(stus[i]==null){
               stus[i]=newStu;
               return;
           }
        }
    }
    public boolean search(String sname){
        for(int i=0;i<stus.length;i++){
           if(sname.equals(stus[i])){
               return true;
           }
        }
        return false;

    }
    public boolean search2(String name,int start ,int end){
        for(int i=start;i<=end;i++){
            if(name.equals(stus[i])){
                return true;
            }
        }
        return false;
    }

    public void showClsInfo(){
        System.out.println("班级名称："+clsName+",指导老师："+dirTeacher);
        System.out.println("学员姓名如下：");
        for(int i=0;i<stus.length;i++){
            if(stus[i]==null)
                return;
            System.out.println(stus[i]);
        }
    }
}
